#include <stdio.h>


int getFibo_recur(int count, int totalc, int prev, int now){
	if(totalc == 0) return 0;
	if(totalc == 1) return 1;

	int nextV = prev + now;
	count++;
	if(count == totalc) return nextV;
	return getFibo_recur(count, totalc, now, nextV);
}

int getFibo(int n){
	//Check Corner 0 1
	if(n == 0) return 0;
	if(n == 1) return 1;

	int val = 1;
	int lastVal = 0;	
	for(int i = 2; i < n; i++){
		int nextV = val + lastVal;
		lastVal = val;
		val = nextV;
	}
	return val;
}

int main(){
	int idx = 9;
	int val = getFibo_recur(2, idx, 0, 1); 
	printf("%dth position fibo = %d\n", idx, val);
	val = getFibo(idx);
	printf("%dth position fibo = %d\n", idx, val);
	return 0;
}
